/*
 * @Author: Soulmate
 * @Date: 2023-11-16 14:18:56
 * @LastEditTime: 2023-11-16 14:20:11
 * @LastEditors: Soulmate
 * @Description: 
 * @FilePath: \electron-app\electron\plugin\initWindowConfig\index.ts
 * 版权声明
 */
const { ipcMain, nativeTheme } = require('electron');

const initWindowConfig = () => { 
    ipcMain.handle('dark-mode:toggle', () => {
        if (nativeTheme.shouldUseDarkColors) {
            nativeTheme.themeSource = 'light';
        } else {
            nativeTheme.themeSource = 'dark';
        }
        return nativeTheme.shouldUseDarkColors;
    });

    ipcMain.handle('dark-mode:system', () => {
        nativeTheme.themeSource = 'system';
    });
}

module.exports = initWindowConfig